home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Purity / Purity #52 (1995-10-30)(PackMAN)(DE)[WB, FFS].zip / Purity #52 (1995-10-30)(PackMAN)(DE)[WB, FFS].adf / Locale_Incl / Locale.i next >
Text File  |  1995-10-01  |  12KB  |  311 lines

  1.   {   locale.library interface structures and definitions  }
  2.  
  3.  
  4. {$I "Include:Exec/Nodes.i"}
  5. {$I "Include:Exec/Lists.i"}
  6. {$I "Include:Exec/Libraries.i"}
  7. {$I "Include:Utility/TagItem.i"}
  8. {$I "Include:DOS/DOS.i"}
  9. {$I "Include:Utility/Hooks.i"}
  10.  
  11. const
  12. { constants for GetLocaleStr() }
  13.  DAY_1          = 1;       { Sunday    }
  14.  DAY_2          = 2;       { Monday    }
  15.  DAY_3          = 3;       { Tuesday   }
  16.  DAY_4          = 4;       { Wednesday }
  17.  DAY_5          = 5;       { Thursday  }
  18.  DAY_6          = 6;       { Friday    }
  19.  DAY_7          = 7;       { Saturday  }
  20.  
  21.  ABDAY_1        = 8 ;      { Sun }
  22.  ABDAY_2        = 9 ;      { Mon }
  23.  ABDAY_3        = 10;      { Tue }
  24.  ABDAY_4        = 11;      { Wed }
  25.  ABDAY_5        = 12;      { Thu }
  26.  ABDAY_6        = 13;      { Fri }
  27.  ABDAY_7        = 14;      { Sat }
  28.  
  29.  MON_1          = 15;      { January   }
  30.  MON_2          = 16;      { February  }
  31.  MON_3          = 17;      { March     }
  32.  MON_4          = 18;      { April     }
  33.  MON_5          = 19;      { May       }
  34.  MON_6          = 20;      { June      }
  35.  MON_7          = 21;      { July      }
  36.  MON_8          = 22;      { August    }
  37.  MON_9          = 23;      { September }
  38.  MON_10         = 24;      { October   }
  39.  MON_11         = 25;      { November  }
  40.  MON_12         = 26;      { December  }
  41.  
  42.  ABMON_1        = 27;      { Jan }
  43.  ABMON_2        = 28;      { Feb }
  44.  ABMON_3        = 29;      { Mar }
  45.  ABMON_4        = 30;      { Apr }
  46.  ABMON_5        = 31;      { May }
  47.  ABMON_6        = 32;      { Jun }
  48.  ABMON_7        = 33;      { Jul }
  49.  ABMON_8        = 34;      { Aug }
  50.  ABMON_9        = 35;      { Sep }
  51.  ABMON_10       = 36;      { Oct }
  52.  ABMON_11       = 37;      { Nov }
  53.  ABMON_12       = 38;      { Dec }
  54.  
  55.  YESSTR         = 39;      { affirmative response for yes/no queries }
  56.  NOSTR          = 40;      { negative response for yes/no queries    }
  57.  
  58.  AM_STR         = 41;      { AM }
  59.  PM_STR         = 42;      { PM }
  60.  
  61.  SOFTHYPHEN     = 43;      { soft hyphenation }
  62.  HARDHYPHEN     = 44;      { hard hyphenation }
  63.  
  64.  OPENQUOTE      = 45;      { start of quoted block }
  65.  CLOSEQUOTE     = 46;      { end of quoted block   }
  66.  
  67.  YESTERDAYSTR   = 47;      { Yesterday }
  68.  TODAYSTR       = 48;      { Today     }
  69.  TOMORROWSTR    = 49;      { Tomorrow  }
  70.  FUTURESTR      = 50;      { Future    }
  71.  
  72.  MAXSTRMSG      = 51;      { current number of defined strings }
  73.  
  74.  
  75. {***************************************************************************}
  76.  
  77. Type
  78. { OpenLibrary("locale.library",0) returns a pointer to this structure }
  79.  LocaleBaseRec = Record
  80.     lb_LibNode      : Library;
  81.     lb_SysPatches   : Boolean;   { TRUE if locale installed its patches }
  82.  end;
  83.  
  84. VAR LocaleBase : Address;
  85.  
  86. {***************************************************************************}
  87.  
  88. Type
  89. { This structure must only be allocated by locale.library and is READ-ONLY! }
  90.  Locale = Record
  91.     loc_LocaleName,                         { locale's name               }
  92.     loc_LanguageName    : String;           { language of this locale     }
  93.     loc_PrefLanguages   : Array[0..9] of String;    { preferred languages }
  94.     loc_Flags           : Integer;          { always 0 for now            }
  95.  
  96.     loc_CodeSet,                            { always 0 for now            }
  97.     loc_CountryCode,                        { user's country code         }
  98.     loc_TelephoneCode,                      { country's telephone code    }
  99.     loc_GMTOffset       : Integer;          { minutes from GMT            }
  100.     loc_MeasuringSystem,                    { what measuring system?      }
  101.     loc_CalendarType    : Byte;             { what calendar type?         }
  102.     loc_Reserved0       : Array[0..1] of Byte;
  103.  
  104.     loc_DateTimeFormat,                     { regular date & time format  }
  105.     loc_DateFormat,                         { date format by itself       }
  106.     loc_TimeFormat,                         { time format by itself       }
  107.  
  108.     loc_ShortDateTimeFormat,                { short date & time format    }
  109.     loc_ShortDateFormat,                    { short date format by itself }
  110.     loc_ShortTimeFormat,                    { short time format by itself }
  111.  
  112.     { for numeric values }
  113.     loc_DecimalPoint,                       { character before the decimals }
  114.     loc_GroupSeparator,                     { separates groups of digits    }
  115.     loc_FracGroupSeparator : String;        { separates groups of digits    }
  116.     loc_Grouping,                           { size of each group            }
  117.     loc_FracGrouping    : Address;          { size of each group            }
  118.  
  119.     { for monetary values }
  120.     loc_MonDecimalPoint,
  121.     loc_MonGroupSeparator,
  122.     loc_MonFracGroupSeparator : String;
  123.     loc_MonGrouping,
  124.     loc_MonFracGrouping : Address;
  125.     loc_MonFracDigits,                      { digits after the decimal point   }
  126.     loc_MonIntFracDigits : Byte;            { for international representation }
  127.     loc_Reserved1       : Array[0..1] of Byte;
  128.  
  129.     { for currency symbols }
  130.     loc_MonCS,                              { currency symbol              }
  131.     loc_MonSmallCS,                         { symbol for small amounts     }
  132.     loc_MonIntCS        : String;           { internationl (ISO 4217) code }
  133.  
  134.     { for positive monetary values }
  135.     loc_MonPositiveSign : String;           { indicate positive money value   }
  136.     loc_MonPositiveSpaceSep,                { determine if separated by space }
  137.     loc_MonPositiveSignPos,                 { position of positive sign       }
  138.     loc_MonPositiveCSPos,                   { position of currency symbol     }
  139.     loc_Reserved2       : Byte;
  140.  
  141.     { for negative monetary values }
  142.     loc_MonNegativeSign : String;           { indicate negative money value   }
  143.     loc_MonNegativeSpaceSep,                { determine if separated by space }
  144.     loc_MonNegativeSignPos,                 { position of negative sign       }
  145.     loc_MonNegativeCSPos,                   { position of currency symbol     }
  146.     loc_Reserved3       : Byte;
  147.  end;
  148.  LocalePtr = ^Locale;
  149.  
  150. const
  151. { constants for Locale.loc_MeasuringSystem }
  152.  MS_ISO         = 0;       { international metric system }
  153.  MS_AMERICAN    = 1;       { american system             }
  154.  MS_IMPERIAL    = 2;       { imperial system             }
  155.  MS_BRITISH     = 3;       { british system              }
  156.  
  157. { constants for Locale.loc_CalendarType }
  158.  CT_7SUN        = 0;       { 7 days a week, Sunday is the first day    }
  159.  CT_7MON        = 1;       { 7 days a week, Monday is the first day    }
  160.  CT_7TUE        = 2;       { 7 days a week, Tuesday is the first day   }
  161.  CT_7WED        = 3;       { 7 days a week, Wednesday is the first day }
  162.  CT_7THU        = 4;       { 7 days a week, Thursday is the first day  }
  163.  CT_7FRI        = 5;       { 7 days a week, Friday is the first day    }
  164.  CT_7SAT        = 6;       { 7 days a week, Saturday is the first day  }
  165.  
  166. { constants for Locale.loc_MonPositiveSpaceSep and Locale.loc_MonNegativeSpaceSep }
  167.  SS_NOSPACE     = 0;       { cur. symbol is NOT separated from value with a space }
  168.  SS_SPACE       = 1;       { cur. symbol IS separated from value with a space     }
  169.  
  170. { constants for Locale.loc_MonPositiveSignPos and Locale.loc_MonNegativeSignPos }
  171.  SP_PARENS      = 0;       { () surround the quantity and currency_symbol   }
  172.  SP_PREC_ALL    = 1;       { sign string comes before amount and symbol     }
  173.  SP_SUCC_ALL    = 2;       { sign string comes after amount and symbol      }
  174.  SP_PREC_CURR   = 3;       { sign string comes right before currency symbol }
  175.  SP_SUCC_CURR   = 4;       { sign string comes right after currency symbol  }
  176.  
  177. { constants for Locale.loc_MonPositiveCSPos and Locale.loc_MonNegativeCSPos }
  178.  CSP_PRECEDES   = 0;  { currency symbol comes before value }
  179.  CSP_SUCCEEDS   = 1;  { currency symbol comes after value  }
  180.  
  181. { elements of the byte arrays pointed to by:
  182.  *   Locale.loc_Grouping
  183.  *   Locale.loc_FracGrouping
  184.  *   Locale.loc_MonGrouping
  185.  *   Locale.loc_MonFracGrouping
  186.  * are interpreted as follows:
  187.  *
  188.  *    255     indicates that no further grouping is to be performed
  189.  *    0       indicates that the previous element is to be repeatedly used
  190.  *            for the remainder of the digits
  191.  *    <other> the number of digits that comprises the current group
  192.  }
  193.  
  194.  
  195. {***************************************************************************}
  196.  
  197.  
  198. { Tags for OpenCatalog() }
  199.  OC_TagBase         = (TAG_USER + $90000);
  200.  OC_BuiltInLanguage = OC_TagBase+1;   { language of built-in strings    }
  201.  OC_BuiltInCodeSet  = OC_TagBase+2;   { code set of built-in strings    }
  202.  OC_Version         = OC_TagBase+3;   { catalog version number required }
  203.  OC_Language        = OC_TagBase+4;   { preferred language of catalog   }
  204.  
  205.  
  206. {***************************************************************************}
  207.  
  208.  
  209. { Comparison types for StrnCmp() }
  210.  SC_ASCII    = 0;
  211.  SC_COLLATE1 = 1;
  212.  SC_COLLATE2 = 2;
  213.  
  214.  
  215. {***************************************************************************}
  216.  
  217. Type
  218. { This structure must only be allocated by locale.library and is READ-ONLY! }
  219.  Catalog = Record
  220.     cat_Link    : Node;         { for internal linkage    }
  221.     cat_Pad     : WORD;         { to longword align       }
  222.     cat_Language: String;       { language of the catalog }
  223.     cat_CodeSet : Integer;      { currently always 0      }
  224.     cat_Version : WORD;         { version of the catalog  }
  225.     cat_Revision: WORD;         { revision of the catalog }
  226.  end;
  227.  CatalogPtr = ^Catalog;
  228.  
  229. {***************************************************************************}
  230.  
  231. { --- functions in V38 or higher (Release 2.1) --- }
  232.  
  233. PROCEDURE CloseCatalog(cat : CatalogPtr);
  234.     External;
  235.  
  236. PROCEDURE CloseLocale(Loc : LocalePtr);
  237.     External;
  238.  
  239. FUNCTION ConvToLower(Loc : LocalePtr; Character : Address) : Integer;
  240.     External;
  241.  
  242. FUNCTION ConvToUpper(Loc : LocalePtr; Character : Address) : Integer;
  243.     External;
  244.  
  245. PROCEDURE FormatDate(Loc : LocalePtr; fmtTemplate : String;
  246.                      date : DateStampPtr; putchrfunc : HookPtr;);
  247.     External;
  248.  
  249. FUNCTION FormatString(Loc : LocalePtr; fmtTemplate : String;
  250.                       DataStream : Address; PutChrFunc : HookPtr;) : Address;
  251.     External;
  252.  
  253. FUNCTION GetCatalogStr(Cat : CatalogPtr; StrNum : Integer; DefaultString : String) : String;
  254.     External;
  255.  
  256. FUNCTION GetLocaleStr(Loc : LocalePtr; StrNum : Integer) : String;
  257.     External;
  258.  
  259. FUNCTION LOC_IsAlNum(Loc : LocalePtr; character : Address) : Boolean;
  260.     External;
  261.  
  262. FUNCTION LOC_IsAlpha(Loc : LocalePtr; character : Address) : Boolean;
  263.     External;
  264.  
  265. FUNCTION LOC_IsCntrl(Loc : LocalePtr; character : Address) : Boolean;
  266.     External;
  267.  
  268. FUNCTION LOC_IsDigit(Loc : LocalePtr; character : Address) : Boolean;
  269.     External;
  270.  
  271. FUNCTION LOC_IsGraph(Loc : LocalePtr; character : Address) : Boolean;
  272.     External;
  273.  
  274. FUNCTION LOC_IsLower(Loc : LocalePtr; character : Address) : Boolean;
  275.     External;
  276.  
  277. FUNCTION LOC_IsPrint(Loc : LocalePtr; character : Address) : Boolean;
  278.     External;
  279.  
  280. FUNCTION LOC_IsPunct(Loc : LocalePtr; character : Address) : Boolean;
  281.     External;
  282.  
  283. FUNCTION LOC_IsSpace(Loc : LocalePtr; character : Address) : Boolean;
  284.     External;
  285.  
  286. FUNCTION LOC_IsUpper(Loc : LocalePtr; character : Address) : Boolean;
  287.     External;
  288.  
  289. FUNCTION LOC_IsXDigit(Loc : LocalePtr; character : Address) : Boolean;
  290.     External;
  291.  
  292. FUNCTION OpenCatalogA(Loc : LocalePtr; name : String; TagList : Address) : CatalogPtr;
  293.     External;
  294.  
  295. FUNCTION OpenLocale(name : String) : LocalePtr;
  296.     External;
  297.  
  298. FUNCTION ParseDate(Loc : LocalePtr; Date : DateStampPtr;
  299.                    fmtTemplate : String; GetCharFunc : HookPtr) : Boolean;
  300.     External;
  301.  
  302. FUNCTION StrConvert(Loc : LocalePtr; Str : String; Buffer : Address;
  303.                     BufferSize, Typ : Integer) : Integer;
  304.     External;
  305.  
  306. FUNCTION LOC_StrnCmp(Loc : LocalePtr; Str1, Str2 : String; length, Typ : Integer) : Integer;
  307.     External;
  308.  
  309.  
  310.  
  311.